home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 231 / 231.d81 / t.dbasic intro < prev    next >
Text File  |  2022-08-26  |  7KB  |  313 lines

  1. u
  2.            D O T B A S I C
  3.            by Dave Moorman
  4.  
  5.  
  6.     Creating applications with all the
  7. pazzazz and sparkle of mouse control
  8. just got easier -- with DOTBASIC. This
  9. is an extension to BASIC 2.0 that
  10. includes Mr.Mouse 2.1, Visual Design,
  11. Object Oriented Programming, and an
  12. Event Driven environment.
  13.  
  14.     These are concepts being used in
  15. PC programming languages such as
  16. Visual Basic.
  17.  
  18.   VISUAL. The programmer "draws" the
  19. screen (rather than writing a bunch of
  20. PRINT statements), using
  21.  
  22.   OBJECTS. A button has length, width,
  23. color, caption, and more. These are
  24. attributes to the Button Object. The
  25. programmer sets the attributes
  26. (visually) and doesn't have to worry
  27. about it again. OBJECTS also have one
  28. or more
  29.  
  30.   EVENT attributes. When the user
  31. clicks the button, the Event Handling
  32. subroutine (written by the programmer)
  33. is called, making the button do
  34. whatever the button does.
  35.  
  36.     DOTBASIC brings these to our
  37. modest world, making coding quick and
  38. painless. (OK -- we're going hyper-
  39. bolic here!) But imagine you have a
  40. utility in mind, one with several
  41. functions to be presented on the main
  42. screen. Here are the three steps to
  43. making a DOTBASIC program.
  44.  
  45.  
  46.            DRAW IT VISUALLY
  47.  
  48.     LOAD and RUN "B.VDOT", the visual
  49. design program. Here you can type,
  50. draw blocks of text, edit the font,
  51. and paint colors. (Check the [Control]
  52. menu for the various options.) Design
  53. your screen the way you want it to
  54. appear.
  55.  
  56.     Now create Event Regions on your
  57. screen. Press <F1> (to make the menu
  58. bar appear) and click [Edit] > [Box].
  59. Move the square pointer to the upper
  60. left corner of the area you want the
  61. user to click for some particular
  62. function. For example, you probably
  63. have a "QUIT" button. Once the square
  64. in is place, click, then move the
  65. mouse down and right to open up the
  66. brackets to enclose the area you want
  67. for an Event Region. Click again.
  68.  
  69.     The Edit menu will reopen. Click
  70. [Add Region]. You are presented with a
  71. suggested Line Number. Press <Return>.
  72. For Right Click Enable, press <N>. For
  73. Hotkey, choose an appropriate letter
  74. key and input it.
  75.  
  76.     Now input the Unhighlighted color
  77. (probably the color you are using for
  78. the button), and press <Y> if you want
  79. it reversed. Do the likewise (with
  80. different colors or reversal) for the
  81. Highlighted color. Finally, Press
  82. <Y> if everything is the way you want
  83. it.
  84.  
  85.     Repeat the process for each Event
  86. Region you want. (Or later you can run
  87. VDOT, load your file, and add Regions
  88. at will.) When done, click [File] >
  89. [Save] and choose the [MED] file
  90. option.
  91.  
  92.     Type in the filename you want for
  93. this program. All working files will
  94. use the same name (with different
  95. prefixes and extensions). Click OK.
  96. Then click [File] > [Exit].
  97.  
  98.  
  99.              BUILD A BOOT
  100.  
  101.     Step two is to create your program
  102. template. This is extremely easy.
  103. LOAD"B.DOT",dv and list line 60008.
  104. Change the line to include your
  105. program name (the one you used for
  106. your MED file -- without the .MED).
  107.  
  108.     60008 N$="MYPROG"
  109.  
  110. Then type
  111.  
  112.     GOTO60000<RETURN>
  113.  
  114. to save your new boot file. Once it is
  115. saved, RUN it.
  116.  
  117.     The boot program will look for
  118. "MYPROG.DOT" -- and if it is not
  119. present, will create it for you. (You
  120. will see some text flash on the screen
  121. as this happens, but don't worry! It
  122. only happens once.) The title screen
  123. will appear.
  124.  
  125.     The DOT program will then attempt
  126. to attach the Event Regions you
  127. designed and assigned to the
  128. subroutine line number(s). Since they
  129. are not present yet, the line numbers
  130. and default commands are displayed on
  131. the screen, followed by an UNDEF'D
  132. LINE NUMBER  ERROR.
  133.  
  134.     Move the cursor up to the
  135. displayed line numbers and press
  136. <RETURN> on each. Type
  137.  
  138.           GOTO60000<RETURN>
  139.  
  140.  Then RUN the program again.
  141.  
  142.     Your designed screen will appear,
  143. along with the mouse arrow. Use the
  144. mouse, cursor keys, or joystick to
  145. move the arrow. When it is over an
  146. Event Region, the color will change to
  147. the Highlighted color you selected.
  148. You can cycle through hightlighted
  149. Event Regions by pressing the <UP
  150. ARROW>.
  151.  
  152.     However, at this point, clicking
  153. on the Event Region will not do
  154. anything -- because you have not
  155. written the Event Handling
  156. Subroutines.
  157.  
  158.  
  159.            WRITING THE CODE
  160.  
  161.     Press <BACK ARROW> to Escape the
  162. program, and LIST it. You will see:
  163.  
  164.  90 SYS5120
  165.  100 .DO:.EE:.WA:.UN E%:.OF
  166.  101 END
  167.  
  168.     Welcome to DOTBASIC! You have up
  169. to 72 new commands at your disposal,
  170. several of which are right here.
  171.  
  172.  .DO starts the DO-loop.
  173.  
  174.  .EE Enables the Event Sensor.
  175.  
  176.  .WA Watches for a <BACK ARROW>
  177.      keypress.
  178.  
  179.  .UN E% loops back to the .DO until E%
  180.      is not 0.
  181.  
  182.  .OF turns off DOTBASIC and puts BASIC
  183.      2.0 back where it was when
  184.      SYS5120 was called.
  185.  
  186.     Now you may be wondering how the
  187. program gets to the subroutines! It
  188. all happens behind the scenes, making
  189. this an Event Driven program
  190. environment.
  191.  
  192.     Let's do the EXIT routine,
  193. assuming the Event Region is attached
  194. to line 1000.
  195.  
  196.  1000 REM"       EXIT
  197.  1005 .RU, 218, 215
  198.  1010 E% = I%
  199.  1015 .ER
  200.  1020 RETURN
  201.  
  202.     Enter these lines and RUN the
  203. program. You should see an "Are You
  204. Sure?" box with an active Yes/No
  205. control.
  206.  
  207.  
  208.            [IMPORTANT NOTE]
  209.  
  210.     If you have an ERROR, type
  211.  
  212.              .OF<RETURN>
  213.  
  214.  before trying to edit the code. This
  215. turns off everything so no problems
  216. will occur.
  217.  
  218.     Here are the meanings of the
  219. commands:
  220.  
  221.  .RU,u,h turns on the Are You Sure box
  222.    and waits for the Yes or No to be
  223.    clicked. Yes: I% = -1. No: I% = 0.
  224.    U is the unhighlighted color. H is
  225.    the Highlighted color. Add 208 to
  226.    the color code of both the get the
  227.    selected item unreversed.
  228.  
  229.  E% = I% puts the result of .RU
  230.    (in I%) into E%. Remember, when E%
  231.    is not 0, the .UN command in the
  232.    main loop falls through.
  233.  
  234.  .ER Event screen Restore. When an
  235.    Event occurs, the screen is stashed
  236.    at page 232. This command brings it
  237.    back.
  238.  
  239.  RETURN takes DOTBASIC back to the
  240.    main loop. The Event Sensor is
  241.    turned off during Event Handling,
  242.    which is why .EE (Event Enable) is
  243.    in the main loop.
  244.  
  245.  
  246.     After you have writen the code for
  247. each attached Event, your program is
  248. finished! And remember, you have 77
  249. commands to do marvelous things with
  250. your program!
  251.  
  252.     When copying your program to a
  253. separate disk, copy the following
  254. files (MYPROG = Your Program Name):
  255.  
  256.     B.MYPROG
  257.     MYPROG.MED
  258.     MYPROG.DOT
  259.     MOUSE2.1 7K 2400
  260.     DF.ML
  261.  
  262.     You can use Lee Novak's LINKER and
  263. PACKER to put everything together in a
  264. single program file. For the BASIC
  265. file, choose MYPROG.DOT. Add Modules
  266. -- MYPROG.MED, MOUSE2.1 7K 2400, and
  267. DF.ML. You will have to change the
  268. load address of MYPROG.MED to 57344
  269. (Page 224). You will no longer need
  270. B.MYPROG to boot your program.
  271.  
  272.  
  273. SOME TECHNICAL INFORMATION
  274.  
  275.     DOTBASIC uses several variable
  276. names to pass information from the ML
  277. routines to BASIC:
  278.  
  279.     I% - The all-purpose Integer.
  280.  
  281.     E% - The Enable flag, used in the
  282.       main loop, which will continue
  283.       as long as E% = 0.
  284.  
  285.     FP - The Floating Point variable
  286.       for returning values too large
  287.       for I%.
  288.  
  289.     DOTBASIC uses only one area above
  290. page 64:
  291.  
  292.  Pages 224-242 is where your MED file
  293. is loaded and the main screen is
  294. stashed during Event Handling
  295. routines.
  296.  
  297.     And don't forget to type
  298.  
  299.              .OF<RETURN>
  300.  
  301.  after every BASIC ERROR.
  302.  
  303.  
  304.     Be sure to read the DOTBASIC
  305. Command List for descriptions of each
  306. command. Next month, we will include
  307. Lee Novak's masterful Mr.Mouse2.1
  308. documentation -- updated with DOTBASIC
  309. commands.
  310.  
  311.  DMM
  312.  
  313.  
  314.